package com.lixin.smartclassroom.utils

import android.app.Activity
import android.content.Intent
import com.lixin.smartclassroom.ext.child_id
import com.lixin.smartclassroom.ext.child_name
import com.lixin.smartclassroom.ext.user_image
import com.lixin.smartclassroom.ext.user_name
import com.lixin.smartclassroom.ext.user_role
import com.lixin.smartclassroom.ui.login.LoginActivity
import com.lixinkeji.extension.isLogin

/**
 * Description
 * Author: lwc
 * Date:2023/11/3 14:43
 */
class LoginManager {
    companion object {
        fun logout(activity: Activity) {
            activity.user_name = ""
            activity.user_role = 0
            activity.user_image = ""
            activity.child_id = ""
            activity.child_name = ""
            activity.isLogin = false

            var intent = Intent()
            //下面2个flags ,可以将原有任务栈清空
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)

            intent.setClass(activity, LoginActivity::class.java)
            activity.startActivity(intent);
            activity.overridePendingTransition(0, 0)
        }


    }
}